package com.zjj.sc.movie.controller;

import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.zjj.sc.movie.controller.UserFeignClient.FeignClientFallback;
import com.zjj.sc.movie.dto.User;

@FeignClient(name = "microservice-4-provider-user" , fallback = FeignClientFallback.class)
public interface UserFeignClient {
	
	@RequestMapping(value = "/{id}" , method = RequestMethod.GET)
	public User findById(@PathVariable("id") Long id);
	

	@Component
	class FeignClientFallback implements UserFeignClient {
		@Override
		public User findById(Long id) {
			User user = new User();
			user.setId(-2L);
			user.setName("zzzzzz");
			return user;
		}
		
	}

}
